/*
 * $Id: stdio.h,v 1.19 2006-01-01 10:12:47 bacon Exp $
 */
 
#ifndef _XP_BAS_STDIO_H_
#define _XP_BAS_STDIO_H_

#include <xp/types.h>
#include <xp/macros.h>
#include <xp/bas/stdarg.h>

#include <stdio.h>
#include <wchar.h>

#define XP_FILE   FILE
#define xp_stdin  stdin
#define xp_stdout stdout
#define xp_stderr stderr

#if defined(XP_CHAR_IS_MCHAR)
	#define xp_fgetc fgetc
	#define xp_fputc fputc
	#define xp_fputs fputs
#else
	#define xp_fgetc fgetwc
	#define xp_fputc fputwc
	#define xp_fputs fputws
#endif

#define xp_fclose   fclose
#define xp_ferror   ferror
#define xp_feof     feof
#define xp_clearerr clearerr
#define xp_fileno   fileno
#define xp_fflush   fflush

#ifdef __cplusplus
extern "C" {
#endif

XP_FILE* xp_fopen (const xp_char_t* path, const xp_char_t* mode);
int xp_printf (const xp_char_t* fmt, ...);
int xp_fprintf (XP_FILE* file, const xp_char_t* fmt, ...);
int xp_vprintf (const xp_char_t* fmt, xp_va_list ap);
int xp_vfprintf (XP_FILE *stream, const xp_char_t* fmt, xp_va_list ap);
int xp_sprintf (
	xp_char_t* buf, xp_size_t size, const xp_char_t* fmt, ...);
int xp_vsprintf (
	xp_char_t* buf, xp_size_t size, const xp_char_t* fmt, xp_va_list ap);

#ifdef __cplusplus
}
#endif

#endif
